package oop2;

/**
 * Created with IntelliJ IDEA.
 * ClassName: UserTest
 * Package: oop2
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-11-21
 * Time: 14:58
 */

public class UserTest {
}

class User{
    String name;
    int age;
    public User(){
        //对象创建初始化 很多代码
        //每个构造都要写很多 那么 出现 this 调用构造器
    }
    public User(String name){
        this(); //就表示调用空参的构造器
        this.name = name;
    }
    public User(String name,int age){
        this(name);
        //this.name = name;
        this.age = age;
    }
}
